var CandyO = CandyO || {};
CandyO.End = function(t) {
    this.buttonStart = null ,
    this.create = function() {
        var e = ["batman", "captain", "hulk"]
          , i = Phaser.ArrayUtils.getRandomItem(e)
          , a = t.add.sprite(0, 0, "final-" + i)
          , s = Math.min(CandyO.SAFE_ZONE_WIDTH / a.width, CandyO.SAFE_ZONE_HEIGHT / a.height);
        a.scale.set(s, s),
        a.anchor.set(.5, .5),
        a.x = CandyO.SAFE_ZONE_WIDTH / 2,
        a.y = CandyO.SAFE_ZONE_HEIGHT / 2,
        this.buttonStart = t.add.button(t.world.centerX, CandyO.SAFE_ZONE_HEIGHT - 67, "button-start", this.startGameClicked, this, 0, 1, 1),
        this.buttonStart.anchor.set(.5, 0);
        var n = CandyO.Game.LeftPlayer.points > CandyO.Game.RightPlayer.points ? CandyO.Game.LeftPlayer : CandyO.Game.RightPlayer
          , o = t.add.text(t.world.centerX, 20, i + " likes " + n.name.toUpperCase(), {
            font: "bold 32px Arial",
            fill: "#ffffff",
            style: "bold",
            align: "center"
        });
        o.anchor.set(.5, 0),
        setTimeout(function() {
            CandyO.Game.yeahSound.play()
        }, 500)
    }
    ,
    this.startGameClicked = function() {
        t.state.start("Menu")
    }
}
;
var CandyO = CandyO || {};
CandyO.Menu = function(t) {
    this.leftGroup = new Array,
    this.rightGroup = new Array,
    this.buttonStart = null ,
    this.preload = function() {}
    ,
    this.create = function() {
        CandyO.Game.resetPlayers(),
        CandyO.Game.boomSound = t.add.audio("sound-boom", CandyO.Game.VOLUME),
        CandyO.Game.boomSound.allowMultiple = !0,
        CandyO.Game.laserSound = t.add.audio("sound-laser", CandyO.Game.VOLUME),
        CandyO.Game.laserSound.allowMultiple = !0,
        CandyO.Game.tomasSound = t.add.audio("sound-tomas", 1),
        CandyO.Game.tomasSound.allowMultiple = !1,
        CandyO.Game.lukasSound = t.add.audio("sound-lukas", 1),
        CandyO.Game.lukasSound.allowMultiple = !1,
        CandyO.Game.gabrieleSound = t.add.audio("sound-gabriele", 1),
        CandyO.Game.gabrieleSound.allowMultiple = !1,
        CandyO.Game.vsSound = t.add.audio("sound-vs", 1),
        CandyO.Game.vsSound.allowMultiple = !1,
        CandyO.Game.bravoSound = t.add.audio("sound-bravo", 1),
        CandyO.Game.bravoSound.allowMultiple = !1,
        CandyO.Game.correctSound = t.add.audio("sound-correct", CandyO.Game.VOLUME),
        CandyO.Game.correctSound.allowMultiple = !1,
        CandyO.Game.yeahSound = t.add.audio("sound-yeah", CandyO.Game.VOLUME),
        CandyO.Game.yeahSound.allowMultiple = !1;
        var e = t.add.sprite(CandyO.SAFE_ZONE_WIDTH / 2, 0, "separator");
        e.height = CandyO.SAFE_ZONE_HEIGHT - 80;
        var e = t.add.sprite(0, CandyO.SAFE_ZONE_HEIGHT - 80, "separator");
        e.width = CandyO.SAFE_ZONE_WIDTH;
        var i = this.createButton("tomas", CandyO.Game.tomasSound, "left");
        i.y = 10,
        this.leftGroup.push(i);
        var a = this.createButton("lukas", CandyO.Game.lukasSound, "left");
        a.y = 170,
        this.leftGroup.push(a);
        var s = this.createButton("gabriele", CandyO.Game.gabrieleSound, "left");
        s.y = 330,
        this.leftGroup.push(s);
        var i = this.createButton("tomas", CandyO.Game.tomasSound, "right");
        i.y = 10,
        this.rightGroup.push(i);
        var a = this.createButton("lukas", CandyO.Game.lukasSound, "right");
        a.y = 170,
        this.rightGroup.push(a);
        var s = this.createButton("gabriele", CandyO.Game.gabrieleSound, "right");
        s.y = 330,
        this.rightGroup.push(s),
        this.buttonStart = t.add.button(t.world.centerX, CandyO.SAFE_ZONE_HEIGHT - 67, "button-start", this.startGameClicked, this, 0, 1, 1),
        this.buttonStart.anchor.set(.5, 0),
        this.buttonStart.visible = !1;
        t.add.button(0, CandyO.SAFE_ZONE_HEIGHT - 75, "icon-fullscreen", this.fullScreenClicked, this)
    }
    ,
    this.fullScreenClicked = function() {
        t.scale.isFullScreen ? t.scale.stopFullScreen() : t.scale.startFullScreen(!1)
    }
    ,
    this.startGameClicked = function() {
        CandyO.Game.LeftPlayer.sound.onStop.addOnce(function() {
            CandyO.Game.vsSound.play()
        }),
        CandyO.Game.vsSound.onStop.addOnce(function() {
            CandyO.Game.RightPlayer.sound.play()
        }),
        CandyO.Game.RightPlayer.sound.onStop.addOnce(function() {
            t.state.start("Game")
        }),
        CandyO.Game.LeftPlayer.sound.play()
    }
    ,
    this.createButton = function(e, i, a) {
        var s = t.add.group();
        s.x = "left" == a ? 10 : CandyO.SAFE_ZONE_WIDTH - 135;
        var n = t.add.sprite(0, 0, e);
        n.inputEnabled = !0,
        n.input.useHandCursor = !0,
        "left" == a ? n.events.onInputDown.add(this.LeftPlayerSelected, this) : n.events.onInputDown.add(this.RightPlayerSelected, this),
        n.scale.set(.2, .2),
        n.name = e,
        n.assignedSound = i,
        n.useHandCursor = !0;
        var o;
        if ("left" == a)
            var o = t.add.text(135, 50, e.toUpperCase(), {
                font: "32px Arial",
                fill: "#ffffff",
                align: "left"
            });
        else {
            var o = t.add.text(-30, 50, e.toUpperCase(), {
                font: "32px Arial",
                fill: "#ffffff",
                align: "center"
            });
            o.anchor.set(1, 0)
        }
        return s.addChild(n),
        s.addChild(o),
        s
    }
    ,
    this.LeftPlayerSelected = function(e) {
        for (var i = 0; i < this.leftGroup.length; i++)
            t.add.tween(this.leftGroup[i]).to({
                alpha: .3
            }, 100, Phaser.Easing.Sinusoidal.In, !0, 0),
            t.add.tween(this.leftGroup[i].scale).to({
                x: .9,
                y: .9
            }, 100, Phaser.Easing.Sinusoidal.In, !0, 0);
        t.add.tween(e.parent).to({
            alpha: 1
        }, 100, Phaser.Easing.Sinusoidal.In, !0, 0),
        t.add.tween(e.parent.scale).to({
            x: 1,
            y: 1
        }, 100, Phaser.Easing.Sinusoidal.In, !0, 0),
        CandyO.Game.LeftPlayer.name = e.name,
        CandyO.Game.LeftPlayer.sound = e.assignedSound,
        this.CheckIfGameCanStart()
    }
    ,
    this.RightPlayerSelected = function(e) {
        for (var i = 0; i < this.rightGroup.length; i++)
            t.add.tween(this.rightGroup[i]).to({
                alpha: .3
            }, 100, Phaser.Easing.Sinusoidal.In, !0, 0),
            t.add.tween(this.rightGroup[i].scale).to({
                x: .9,
                y: .9
            }, 100, Phaser.Easing.Sinusoidal.In, !0, 0);
        t.add.tween(e.parent).to({
            alpha: 1
        }, 100, Phaser.Easing.Sinusoidal.In, !0, 0),
        t.add.tween(e.parent.scale).to({
            x: 1,
            y: 1
        }, 100, Phaser.Easing.Sinusoidal.In, !0, 0),
        CandyO.Game.RightPlayer.name = e.name,
        e.name,
        CandyO.Game.RightPlayer.sound = e.assignedSound,
        this.CheckIfGameCanStart()
    }
    ,
    this.CheckIfGameCanStart = function() {
        void 0 != CandyO.Game.LeftPlayer.name && void 0 != CandyO.Game.RightPlayer.name && (this.buttonStart.visible = !0)
    }
    ,
    this.render = function() {}
    ,
    this.update = function() {}
}
;
var Checkbox = function(t, e, i) {
    i = i || {},
    this.settings = FrauenVsRefugees.extendObject({
        backgroundColor: 16777215,
        buttonColor: 16711680,
        width: 100,
        height: 32,
        buttonWidth: 32,
        buttonHeight: 30,
        value: !0
    }, i),
    this.knobFingerId = 0,
    Phaser.Sprite.call(this, game, t, e, "pixel"),
    this.onChange = new Phaser.Signal;
    var a = this.game.add.graphics(0, 0);
    a.beginFill(this.settings.backgroundColor),
    a.lineStyle(1, this.settings.backgroundColor, 1),
    a.drawRect(-1, 0, this.settings.width + 2, this.settings.height),
    a.endFill(),
    this.background = game.add.sprite(0, 0, "pixel"),
    this.background.addChild(a),
    this.addChild(this.background);
    var a = this.game.add.graphics(0, 0);
    a.beginFill(this.settings.buttonColor),
    a.lineStyle(1, this.settings.buttonColor, 1),
    a.drawRect(0, 0, this.settings.buttonWidth, this.settings.buttonHeight),
    a.endFill(),
    a.x = (this.settings.width - this.settings.buttonWidth) / 2,
    a.y = (this.settings.height - this.settings.buttonHeight) / 2,
    this.knob = game.add.sprite(0, 0, "pixel"),
    this.knob.addChild(a),
    this.addChild(this.knob),
    this.background.inputEnabled = !0,
    this.background.events.onInputDown.add(this.change, this),
    this.value = this.settings.value
}
;
Checkbox.prototype = Object.create(Phaser.Sprite.prototype),
Checkbox.prototype.constructor = Checkbox,
Checkbox.prototype.change = function() {
    this.settings.value = !this.settings.value,
    this.knob.visible = this.settings.value,
    this.onChange.dispatch(this.settings.value)
}
,
Object.defineProperty(Checkbox.prototype, "value", {
    get: function() {
        return this.settings.value
    },
    set: function(t) {
        this.settings.value = t,
        this.knob.visible = t
    }
});
var Enemy = function(t, e, i, a) {
    this.id = a,
    this.enemytype = i,
    Phaser.Sprite.call(this, game, 0, 0, this.enemytype),
    this.punchSound = game.add.audio("man-punch", FrauenVsRefugees.VOLUME, !1),
    this.hitSound = game.add.audio("man-hit", FrauenVsRefugees.VOLUME, !1),
    this.kickHitSound = game.add.audio("man-kick-hit", FrauenVsRefugees.VOLUME, !1),
    this._position3D = {
        x: t,
        y: 0,
        z: e - .001
    },
    this.updatePosition(),
    this.shadow = game.add.sprite(0, 0, "shadow"),
    this.shadow.anchor.set(.5, 1),
    FrauenVsRefugees.Game.singleton.addShadow(this.shadow),
    Enemy.enemies[this.name + this.id] = this,
    this.anchor.set(.5, 1),
    this.createAnimations(),
    this.idleAnimation.play(),
    this.direction = 1,
    this.scale.set(1, 1),
    this.wanderingDirection = new Phaser.Point(this.WanderingSpeed.x,this.WanderingSpeed.y),
    this.wanderingTimer = null ,
    this.canStartMoving = !1
}
;
Enemy.prototype = Object.create(Phaser.Sprite.prototype),
Enemy.prototype.constructor = Enemy,
Enemy.prototype.createAnimations = function() {
    console.error("createAnimations should be overwriten by a child class")
}
,
Enemy.prototype.updateState = function(t) {
    if (this.currentState != t)
        switch (this.currentState = t,
        this.currentState) {
        case Enemy.States.idle:
        default:
            this.idleAnimation.play();
            break;
        case Enemy.States.hunting:
            this.huntingAnimation.play(),
            this.startWanderingTimer();
            break;
        case Enemy.States.wandering:
            this.huntingAnimation.play();
            var e = Math.random() < .5 ? -1 : 1
              , i = Math.random() < .5 ? -1 : 1;
            this.wanderingDirection.x = this.WanderingSpeed.x * e,
            this.wanderingDirection.y = this.WanderingSpeed.y * i,
            this.startWanderingTimer();
            break;
        case Enemy.States.punching:
            this.destroyWanderingTimer(),
            this.punchingAnimation.play(),
            game.time.events.add(250, this.hitFrau, this);
            break;
        case Enemy.States.gothit:
            this.destroyWanderingTimer(),
            this.gotHitAnimation.play();
            break;
        case Enemy.States.gotkick:
            this.destroyWanderingTimer(),
            this.gotKickAnimation.play(),
            this.currentState = Enemy.States.gothit;
            break;
        case Enemy.States.gameover:
            var a = game.add.audio("man-fall", FrauenVsRefugees.VOLUME, !1);
            FrauenVsRefugees.SoundManager.play(this.hitSound, 100),
            FrauenVsRefugees.SoundManager.play(a, 100),
            this.destroyWanderingTimer(),
            this.gameoverAnimation.play();
            var e = 30 * this.scale.x
              , s = this.game.add.tween(this._position3D).to({
                x: this._position3D.x + e,
                y: this._position3D.y - 25
            }, 400, Phaser.Easing.Sinusoidal.Out)
              , n = this.game.add.tween(this._position3D).to({
                y: this._position3D.y
            }, 250, Phaser.Easing.Sinusoidal.In);
            s.chain(n),
            s.start()
        }
}
,
Enemy.prototype.changeWalkingType = function() {
    this.destroyWanderingTimer(),
    this.currentState = Enemy.States.none,
    this.updateState(Math.random() < .5 ? Enemy.States.wandering : Enemy.States.hunting)
}
,
Enemy.prototype.startWanderingTimer = function() {
    this.destroyWanderingTimer(),
    this.wanderingTimer = game.time.events.add(1e3 * Math.random() + 1e3, this.changeWalkingType, this)
}
,
Enemy.prototype.destroyWanderingTimer = function() {
    null  != this.wanderingTimer && (game.time.events.remove(this.wanderingTimer),
    this.wanderingTimer = null )
}
,
Enemy.prototype.getPosition = function() {
    return this._position3D
}
,
Enemy.prototype.hitFrau = function() {
    this.currentState != Enemy.States.gothit && this.currentState != Enemy.States.gameover && (FrauenVsRefugees.SoundManager.play(this.punchSound, 100),
    Frau.singleton.receiveHit(this._position3D))
}
,
Enemy.prototype.setIdle = function() {
    this.currentState != Enemy.States.gameover && (this._position3D.y = 0,
    this.changeWalkingType())
}
,
Enemy.prototype.updatePosition = function() {
    this._position3D.x = Math.max(game.camera.view.x / FrauenVsRefugees.VIEW_WINDOW_SCALE, this._position3D.x),
    this._position3D.x = Math.min(FrauenVsRefugees.Game.singleton.getCurrentSectionBounds(), this._position3D.x),
    this._position3D.z = Math.max(-6, this._position3D.z),
    this._position3D.z = Math.min(48, this._position3D.z),
    this.x = this._position3D.x,
    this.y = FrauenVsRefugees.VIEW_CENTER_Y + 50 + this._position3D.z + this._position3D.y,
    this.z = this._position3D.z
}
,
Enemy.prototype.receiveHit = function(t, e) {
    if (this.destroyWanderingTimer(),
    this.currentState != Enemy.States.gothit && this.currentState != Enemy.States.gameOver && (this.scale.x = t,
    this.damage(.41).health > 0)) {
        if (e) {
            var i = this.game.add.tween(this._position3D).to({
                x: this._position3D.x + t * (80 + 20 * Math.random()),
                z: this._position3D.z + 40 * Math.random() - 20,
                y: this._position3D.y - 50
            }, 400, Phaser.Easing.Sinusoidal.Out)
              , a = this.game.add.tween(this._position3D).to({
                y: this._position3D.y
            }, 250, Phaser.Easing.Sinusoidal.In);
            i.chain(a),
            i.start(),
            this.kickHitSound.play(),
            this.updateState(Enemy.States.gotkick)
        } else
            this.updateState(Enemy.States.gothit),
            FrauenVsRefugees.SoundManager.play(this.hitSound, 100);
        FrauenVsRefugees.Game.singleton.enemyProgressBar.updateState(this)
    }
}
,
Enemy.prototype.update = function() {
    if (0 == this.canStartMoving) {
        if (!game.camera.view.contains(this.x * FrauenVsRefugees.VIEW_WINDOW_SCALE, 10))
            return;
        this.canStartMoving = !0,
        this.setIdle()
    }
    if (this.updatePosition(),
    this.shadow.width = this.width,
    this.shadow.alpha = .7 - this._position3D.y / -50,
    this.shadow.position.set(this.x, FrauenVsRefugees.VIEW_CENTER_Y + 50 + this._position3D.z),
    this.currentState != Enemy.States.gothit && (this.currentState == Enemy.States.wandering || this.currentState == Enemy.States.hunting)) {
        var t = Frau.singleton.getPosition()
          , e = t.x - this._position3D.x
          , i = t.z - this._position3D.z
          , a = 0 > e ? -1 : 1
          , s = 0 > i ? -1 : 1
          , n = Math.abs(e)
          , o = Math.abs(i);
        if (60 > n && 5 > o)
            return this.scale.set(-a, 1),
            void this.updateState(Enemy.States.punching);
        if (this.currentState == Enemy.States.wandering)
            return this._position3D.x += this.wanderingDirection.x,
            void (this._position3D.z += this.wanderingDirection.y);
        if (100 > n && (this._position3D.z += this.Speed.y * s),
        n >= 60 && (this._position3D.x += this.Speed.x * a),
        60 > n && 5 > o)
            return this.scale.set(-a, 1),
            void this.updateState(Enemy.States.punching);
        this.scale.set(-a, 1)
    }
}
,
Enemy.prototype.kill = function() {
    FrauenVsRefugees.Game.singleton.enemyProgressBar.updateState(this),
    this.updateState(Enemy.States.gameover)
}
,
Enemy.prototype.gameOver = function() {
    delete Enemy.enemies[this.name + this.id],
    this.destroy(),
    FrauenVsRefugees.Game.singleton.enemyProgressBar.hideIfObjectIsDead(this),
    this.shadow.destroy(),
    FrauenVsRefugees.Game.singleton.enemyDead()
}
,
Enemy.States = {
    gameover: -1,
    idle: 0,
    hunting: 1,
    punching: 2,
    gothit: 3,
    gotkick: 4,
    wandering: 5
},
Enemy.enemies = {};
var EnemyAkarab = function(t, e, i) {
    this.name = "Akarab",
    this.faceImage = 2,
    this.enemytype = "enemyAkarab",
    this.Speed = new Phaser.Point(1,1),
    this.WanderingSpeed = new Phaser.Point(1,1),
    Enemy.call(this, t, e, this.enemytype, i)
}
;
EnemyAkarab.prototype = Object.create(Enemy.prototype),
EnemyAkarab.prototype.constructor = EnemyAkarab,
EnemyAkarab.prototype.createAnimations = function() {
    var t = Phaser.Animation.generateFrameNames("slice", 26, 33, ".png", 2);
    t.push("slice32.png", "slice31.png"),
    this.idleAnimation = this.animations.add("idle", t, 8, !0),
    this.huntingAnimation = this.animations.add("hunting", Phaser.Animation.generateFrameNames("slice", 1, 9, ".png", 2), 10, !0);
    var e = Phaser.Animation.generateFrameNames("slice", 10, 13, ".png", 2);
    e.push("slice10.png", "slice10.png", "slice10.png", "slice10.png", "slice10.png", "slice10.png"),
    this.punchingAnimation = this.animations.add("punching", e, 8, !1),
    this.punchingAnimation.onComplete.add(this.setIdle, this),
    this.gotHitAnimation = this.animations.add("gothit", Phaser.Animation.generateFrameNames("slice", 19, 23, ".png", 2), 12, !1),
    this.gotHitAnimation.onComplete.add(this.setIdle, this),
    this.gotKickAnimation = this.animations.add("gotkick", ["slice14.png", "slice15.png", "slice16.png", "slice17.png", "slice18.png", "slice18.png", "slice18.png", "slice18.png", "slice18.png", "slice18.png", "slice24.png", "slice25.png"], 6, !1),
    this.gotKickAnimation.onComplete.add(this.setIdle, this),
    this.gameoverAnimation = this.animations.add("gamneover", ["slice14.png", "slice15.png", "slice17.png", "slice18.png", "slice00.png", "slice18.png", "slice00.png", "slice18.png", "slice00.png", "slice18.png"], 8, !1),
    this.gameoverAnimation.onComplete.add(this.gameOver, this)
}
;
var EnemyAzill = function(t, e, i) {
    this.name = "Azill",
    this.faceImage = 1,
    this.enemytype = "enemyAzill",
    this.Speed = new Phaser.Point(1,1),
    this.WanderingSpeed = new Phaser.Point(1,1),
    this.health = .8,
    Enemy.call(this, t, e, this.enemytype, i)
}
;
EnemyAzill.prototype = Object.create(Enemy.prototype),
EnemyAzill.prototype.constructor = EnemyAzill,
EnemyAzill.prototype.createAnimations = function() {
    this.idleAnimation = this.animations.add("idle", Phaser.Animation.generateFrameNames("slice", 3, 3, ".png", 2), 8, !0),
    this.huntingAnimation = this.animations.add("hunting", Phaser.Animation.generateFrameNames("slice", 1, 4, ".png", 2), 10, !0);
    var t = Phaser.Animation.generateFrameNames("slice", 6, 9, ".png", 2);
    t.push("slice06.png", "slice06.png", "slice06.png", "slice06.png", "slice06.png", "slice06.png"),
    this.punchingAnimation = this.animations.add("punching", t, 12, !1),
    this.punchingAnimation.onComplete.add(this.setIdle, this),
    this.gotHitAnimation = this.animations.add("gothit", ["slice05.png", "slice05.png"], 4, !1),
    this.gotHitAnimation.onComplete.add(this.setIdle, this),
    this.gotKickAnimation = this.animations.add("gotkick", ["slice05.png", "slice10.png", "slice11.png", "slice12.png", "slice13.png"], 4, !1),
    this.gotKickAnimation.onComplete.add(this.setIdle, this),
    this.gameoverAnimation = this.animations.add("gamneover", ["slice05.png", "slice10.png", "slice11.png", "slice00.png", "slice11.png", "slice00.png", "slice11.png", "slice00.png", "slice11.png"], 4, !1),
    this.gameoverAnimation.onComplete.add(this.gameOver, this)
}
;
var Frau = function() {
    Phaser.Sprite.call(this, game, 0, 0, "frau"),
    this.anchor.set(.5, 1),
    this.name = "Frau",
    this.faceImage = 0,
    this.shadow = game.add.sprite(0, 0, "shadow"),
    this.shadow.anchor.set(.5, 1),
    FrauenVsRefugees.Game.singleton.addShadow(this.shadow),
    this.direction = 1,
    this._position3D = {
        x: 100,
        y: 0,
        z: .001
    },
    this.updatePosition(),
    this.idleAnimation = this.animations.add("idle", Phaser.Animation.generateFrameNames("slice", 1, 4, ".png", 2), 8, !0),
    this.walkingAnimation = this.animations.add("walking", Phaser.Animation.generateFrameNames("slice", 28, 30, ".png", 2), 10, !0),
    this.punchingAnimation = this.animations.add("punching", Phaser.Animation.generateFrameNames("slice", 5, 8, ".png", 2), 12, !1),
    this.punchingAnimation.onComplete.add(this.setIdle, this),
    this.jumpingAnimation = this.animations.add("jumping", Phaser.Animation.generateFrameNames("slice", 9, 13, ".png", 2), 12, !1);
    var t = Phaser.Animation.generateFrameNames("slice", 18, 23, ".png", 2);
    t = t.concat(t),
    this.gotHitAnimation = this.animations.add("gothit", t, 12, !1),
    this.gotHitAnimation.onComplete.add(this.setIdle, this);
    var e = Phaser.Animation.generateFrameNames("slice", 23, 26, ".png", 2);
    e.push("slice26.png", "slice26.png", "slice26.png", "slice00.png", "slice26.png", "slice00.png", "slice26.png", "slice00.png", "slice26.png", "slice00.png"),
    this.gameoverAnimation = this.animations.add("gamover", e, 8, !1),
    this.gameoverAnimation.onComplete.add(this.gameOver, this),
    this.winAnimation = this.animations.add("intro", Phaser.Animation.generateFrameNames("slice", 14, 15, ".png", 2), 10, !0),
    this.cursors = game.input.keyboard.createCursorKeys(),
    this._currentState = null ,
    this.updateState(Frau.States.idle),
    Frau.singleton = this,
    this.punchSound = game.add.audio("woman-punch", FrauenVsRefugees.VOLUME, !1),
    this.punchSound.allowMultiple = !0
}
;
Frau.prototype = Object.create(Phaser.Sprite.prototype),
Frau.prototype.constructor = Frau,
Frau.prototype.updateState = function(t) {
    if (this._currentState != t)
        switch (this._currentState = t,
        this._currentState) {
        case Frau.States.idle:
        default:
            this.idleAnimation.play();
            break;
        case Frau.States.walking:
            this.walkingAnimation.play();
            break;
        case Frau.States.punching:
            this.punchingAnimation.play(),
            this.hitEnemy(!1);
            break;
        case Frau.States.jumping:
            if (0 != this._position3D.y)
                return void (this._currentState = Frau.States.idle);
            this.sound = game.add.audio("frau-jump", FrauenVsRefugees.VOLUME, !1),
            this.sound.play(),
            this.jumpingAnimation.play();
            var e = this.game.add.tween(this._position3D).to({
                y: this._position3D.y - 50
            }, 400, Phaser.Easing.Sinusoidal.Out)
              , i = this.game.add.tween(this._position3D).to({
                y: this._position3D.y
            }, 250, Phaser.Easing.Sinusoidal.In);
            i.onComplete.add(this.landFromJump, this),
            i.onUpdateCallback(this.kickEnemy, this),
            e.chain(i),
            e.start(),
            game.time.events.add(250, this.kickEnemy, this);
            break;
        case Frau.States.gothit:
            this.gotHitAnimation.play();
            break;
        case Frau.States.gameover:
            this.sound = game.add.audio("frau-fall", FrauenVsRefugees.VOLUME, !1),
            this.sound.play(),
            this.gameoverAnimation.play();
            var a = 30 * this.scale.x
              , e = this.game.add.tween(this._position3D).to({
                x: this._position3D.x - a,
                y: this._position3D.y - 25
            }, 400, Phaser.Easing.Sinusoidal.Out)
              , i = this.game.add.tween(this._position3D).to({
                y: this._position3D.y
            }, 250, Phaser.Easing.Sinusoidal.In);
            e.chain(i),
            e.start();
            break;
        case Frau.States.win:
            this.winAnimation.play()
        }
}
,
Frau.prototype.hitEnemy = function(t) {
    if (this.canBeHit()) {
        var e, i, a, s = 1 == t ? 80 : 70;
        t || this.punchSound.play();
        for (var n in Enemy.enemies) {
            if (e = Enemy.enemies[n],
            !e.alive)
                return;
            i = e.getPosition(),
            a = i.x - this._position3D.x,
            this.scale.x > 0 && a > 0 && s > a && Math.abs(this._position3D.z - i.z) < 7 ? e.receiveHit(this.scale.x, t) : this.scale.x < 0 && 0 > a && a > -s && Math.abs(this._position3D.z - i.z) < 7 && e.receiveHit(this.scale.x, t)
        }
    }
}
,
Frau.prototype.kickEnemy = function() {
    this.hitEnemy(!0)
}
,
Frau.prototype.landFromJump = function() {
    this.canBeHit() && this.setIdle()
}
,
Frau.prototype.getPosition = function() {
    return this._position3D
}
,
Frau.prototype.getState = function() {
    return this._currentState
}
,
Frau.prototype.receiveHit = function(t) {
    if (this.canBeHit()) {
        var e = this._position3D.x - t.x
          , i = this._position3D.z - t.z;
        Math.abs(e) < 60 && Math.abs(i) < 5 && (e >= 0 && (this.scale.x = -1),
        this.damage(.1).health > 0 && (FrauenVsRefugees.Game.singleton.frauProgressBar.updateState(this),
        this.updateState(Frau.States.gothit)))
    }
}
,
Frau.prototype.canBeHit = function() {
    return this._currentState != Frau.States.gothit && this._currentState != Frau.States.gameover
}
,
Frau.prototype.kill = function() {
    this.updateState(Frau.States.gameover),
    game.time.events.add(2e3, this.finishGame, this)
}
,
Frau.prototype.finishGame = function() {
    FrauenVsRefugees.Game.singleton.transitionScreen(FrauenVsRefugees.Game.singleton.gotoEndScreen)
}
,
Frau.prototype.gameOver = function() {
    this.destroy(),
    this.shadow.destroy()
}
,
Frau.prototype.setIdle = function() {
    this._position3D.y = 0,
    this.updateState(Frau.States.idle)
}
,
Frau.prototype.updatePosition = function() {
    this._position3D.x = Math.max(game.camera.view.x / FrauenVsRefugees.VIEW_WINDOW_SCALE, this._position3D.x),
    this._position3D.x = Math.min(FrauenVsRefugees.Game.singleton.getCurrentSectionBounds(), this._position3D.x),
    this._position3D.z = Math.max(-6, this._position3D.z),
    this._position3D.z = Math.min(48, this._position3D.z),
    this.x = this._position3D.x,
    this.y = FrauenVsRefugees.VIEW_CENTER_Y + 50 + this._position3D.z + this._position3D.y,
    this.z = this._position3D.z
}
,
Frau.prototype.update = function() {
    if (this.updatePosition(),
    this.shadow.width = this.width,
    this.shadow.alpha = .7 - this._position3D.y / -50,
    this.shadow.position.set(this.x - 5 * this.scale.x, FrauenVsRefugees.VIEW_CENTER_Y + 52 + this._position3D.z),
    this._currentState != Frau.States.win && this.canBeHit()) {
        var t = !1;
        (game.input.keyboard.isDown(Phaser.Keyboard.C) || MobileControler.singleton.isKicking) && this.updateState(Frau.States.jumping),
        this._currentState != Frau.States.jumping && (game.input.keyboard.isDown(Phaser.Keyboard.X) || MobileControler.singleton.isPunching) && this.updateState(Frau.States.punching),
        this.cursors.left.isDown || MobileControler.singleton.direction == Frau.Directions.left ? null  != game.camera.deadzone && (this.scale.x = -1,
        this._position3D.x -= Frau.Speed.x,
        t = !0) : (this.cursors.right.isDown || MobileControler.singleton.direction == Frau.Directions.right) && null  != game.camera.deadzone && (this.scale.x = 1,
        this._position3D.x += Frau.Speed.x,
        t = !0),
        this._currentState != Frau.States.jumping && ((this.cursors.up.isDown || MobileControler.singleton.direction == Frau.Directions.up) && this.canMoveInZ(-Frau.Speed.y) ? (this._position3D.z -= Frau.Speed.y,
        t = !0) : (this.cursors.down.isDown || MobileControler.singleton.direction == Frau.Directions.down) && this.canMoveInZ(Frau.Speed.y) && (this._position3D.z += Frau.Speed.y,
        t = !0)),
        (this._currentState == Frau.States.idle || this._currentState == Frau.States.walking) && this.updateState(1 == t ? Frau.States.walking : Frau.States.idle)
    }
}
,
Frau.prototype.canMoveInZ = function(t) {
    return !0
}
,
Frau.prototype.showWin = function() {
    this._position3D.y = 0,
    this.updateState(Frau.States.win)
}
,
Frau.singleton = this,
Frau.Speed = new Phaser.Point(2,2),
Frau.States = {
    gameover: -1,
    idle: 0,
    walking: 1,
    punching: 2,
    jumping: 3,
    gothit: 4,
    win: 5
},
Frau.Directions = {
    none: new Phaser.Point(0,0),
    up: new Phaser.Point(0,-Frau.Speed.y),
    down: new Phaser.Point(0,Frau.Speed.y),
    left: new Phaser.Point(-Frau.Speed.x,0),
    right: new Phaser.Point(Frau.Speed.x,0)
};
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Boot = function(t) {
    this.preload = function() {
        t.load.image("game-logo", "assets/images/game-logo.png"),
        t.load.spritesheet("progressBar", "assets/images/progressBar.png", 80, 16)
    }
    ,
    this.create = function() {
        t.canvas.className = "frauen-game",
        this.scale.maxWidth = 99999,
        this.scale.maxHeight = 99999,
        t.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL,
        t.scale.fullScreenScaleMode = Phaser.ScaleManager.NO_SCALE,
        t.scale.setShowAll(!0),
        t.scale.refresh(),
        t.scale.pageAlignHorizontally = !0,
        t.scale.pageAlignVertically = !0,
        t.state.start("Preload")
    }
}
;
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Game = function(t) {
    this.create = function() {
        t.time.advancedTiming = !1,
        this.sound = t.add.audio("track-game", FrauenVsRefugees.MUSIC_VOLUME, !0),
        this.sound.play(),
        Enemy.enemies = {},
        this.enemies = {},
        this.enemyNr = 0,
        this.currentSection = 0,
        this.currentWave = 0,
        this.allDeadAlready = !1,
        FrauenVsRefugees.Game.singleton = this,
        this.mainSprite = new ParentSprite,
        t.add.existing(this.mainSprite),
        this.groupStreet = t.add.group(),
        this.groupBottom = t.add.group(),
        this.groupTop = t.add.group(),
        this.mainSprite.addChild(this.groupStreet),
        this.mainSprite.addChild(this.groupBottom),
        this.mainSprite.addChild(this.groupTop),
        this.viewWindow = FrauenVsRefugees.createViewWindow(),
        t.add.existing(this.viewWindow),
        this.viewWindow.addChild(this.mainSprite),
        this.groupGUI = t.add.group(),
        this.groupGUI.scale.set(this.viewWindow.scale.x, this.viewWindow.scale.y),
        this.groupGUI.cameraOffset.x = this.viewWindow.x,
        this.groupGUI.cameraOffset.y = this.viewWindow.y,
        this.groupGUI.fixedToCamera = !0,
        this.mobileControler = new MobileControler,
        FrauenVsRefugees.TOUCH && t.add.existing(this.mobileControler);
        for (var e = 0; 16 > e; e++) {
            var i = t.add.sprite(193 * e, 0, "street", e);
            this.groupStreet.addChild(i)
        }
        t.world.setBounds(0, 0, this.groupStreet.width * this.viewWindow.scale.x, t.height),
        this.frau = new Frau,
        this.groupTop.add(this.frau);
        for (var e = 0; 10 > e; e++) {
            var a = t.add.sprite(0, 0, "police");
            this.groupBottom.addChild(a),
            a.anchor.set(0, 1),
            a.x = 622 * e,
            a.y = 120,
            a.z = -1e3;
            var s = a.animations.add("defent", Phaser.Animation.generateFrameNames("slice", 1, 16, ".png", 2), 8, !0);
            s.play();
            var n = t.add.tween(a).to({
                x: a.x + 30
            }, 1e3, "Linear", !0, 0, -1);
            n.yoyo(!0)
        }
        this.setCameraOnFrau(),
        this.frauProgressBar = new ProgressBar("left"),
        this.frauProgressBar.y = 5,
        this.groupGUI.add(this.frauProgressBar),
        this.frauProgressBar.updateState(this.frau),
        this.enemyProgressBar = new ProgressBar("right"),
        this.enemyProgressBar.y = 5,
        this.enemyProgressBar.x = FrauenVsRefugees.VIEW_WIDTH - 30,
        this.groupGUI.add(this.enemyProgressBar),
        this.enemyProgressBar.visible = !1;
        var o = new PIXI.FilmFilter
          , r = new PIXI.SepiaFilter;
        r.sepia = .7,
        FrauenVsRefugees.GFX && (this.viewWindow.filters = [o, r]),
        this.arrowHauptbahnhof = t.add.sprite(FrauenVsRefugees.VIEW_WIDTH - 110, 10, "arrow-hauptbahnhof"),
        this.groupGUI.addChild(this.arrowHauptbahnhof),
        this.arrowHauptbahnhofBlink = this.arrowHauptbahnhof.animations.add("blink", [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], 4, !1),
        this.arrowHauptbahnhof.visible = !1,
        this.nextWave();
        var h = t.add.sprite(0, 0, "game-logo");
        h.scale.set(.4, .4),
        h.anchor.set(.5, .5),
        h.fixedToCamera = !0,
        h.cameraOffset.set(h.width / 2 + 10, h.height / 2 + 10)
    }
    ,
    this.sectionComplete = function() {
        if (this.currentWave = 0,
        this.currentSection++,
       
        5 == this.currentSection) {
            this.frau.showWin();
            var e = t.add.audio("excelent", FrauenVsRefugees.VOLUME, !1);
            e.play(),
            t.time.events.add(2e3, this.waitForWinTransition, this)
        } else {
            var i = new Phaser.Point;
            i.copyFrom(this.frau),
            i.multiply(this.frau.parent.worldTransform.a, this.frau.parent.worldTransform.d),
            t.camera.x < i.x - t.width / 4 && (t.camera.deadzone = null ,
            t.add.tween(t.camera).to({
                x: i.x - t.width / 4
            }, 500, Phaser.Easing.Linear.None, !0).onComplete.add(this.setCameraOnFrau, this)),
            this.arrowHauptbahnhof.visible = !0,
            this.arrowHauptbahnhofBlink.play(),
            this.nextWave()
        }
    }
    ,
    this.nextWave = function() {
        switch (this.currentWave) {
        case 0:
        case 1:
            for (var t = 0; t < this.currentSection + 1; t++)
                if (0 == this.currentSection) {
                    var e = new EnemyAzill(this.getCurrentSectionBounds() - 50 + 50 * Math.random(),50 * Math.random() + 1,this.enemyNr++);
                    this.groupTop.add(e)
                } else if (Math.random() > .5) {
                    var e = new EnemyAzill(this.getCurrentSectionBounds() - 50 + 50 * Math.random(),50 * Math.random() + 1,this.enemyNr++);
                    this.groupTop.add(e)
                } else {
                    var e = new EnemyAkarab(this.getCurrentSectionBounds() - 50 + 50 * Math.random(),50 * Math.random() + 1,this.enemyNr++);
                    this.groupTop.add(e)
                }
            if (1 == this.currentWave)
                for (var t = 0; t < Math.min(3, this.currentSection + 1); t++)
                    if (0 == this.currentSection) {
                        var e = new EnemyAzill(this.getCurrentSectionBounds() - FrauenVsRefugees.VIEW_WIDTH + 50 - 20 * Math.random(),50 * Math.random() + 1,this.enemyNr++);
                        this.groupTop.add(e)
                    } else if (Math.random() > .5) {
                        var e = new EnemyAzill(this.getCurrentSectionBounds() - FrauenVsRefugees.VIEW_WIDTH + 50 + 20 * Math.random(),50 * Math.random() + 1,this.enemyNr++);
                        this.groupTop.add(e)
                    } else {
                        var e = new EnemyAkarab(this.getCurrentSectionBounds() - FrauenVsRefugees.VIEW_WIDTH + 50,50 * Math.random() + 1,this.enemyNr++);
                        this.groupTop.add(e)
                    }
            this.currentWave++;
            break;
        case 2:
            this.sectionComplete()
        }
        this.allDeadAlready = !1
    }
    ,
    this.setCameraOnFrau = function() {
        t.camera.deadzone = new Phaser.Rectangle(0,0,t.width / 4,t.world.height)
    }
    ,
    this.enemyDead = function() {
        if (1 != this.allDeadAlready) {
            for (var t in Enemy.enemies)
                if (t && Enemy.enemies[t].alive)
                    return;
            this.allDeadAlready = !0,
            this.nextWave()
        }
    }
    ,
    this.getCurrentSectionBounds = function() {
        return Math.min(this.groupStreet.width, (this.currentSection + 1) * FrauenVsRefugees.VIEW_WIDTH)
    }
    ,
    this.initParticles = function() {
        this.particleManager = t.plugins.add(Phaser.ParticleStorm);
        var e = {
            image: "caboom",
            lifespan: {
                min: 400,
                max: 600
            },
            delay: {
                min: 0,
                max: 200
            },
            scale: {
                value: 1,
                control: [{
                    x: 0,
                    y: .3
                }, {
                    x: .25,
                    y: .75
                }, {
                    x: .8,
                    y: 1
                }, {
                    x: 1,
                    y: 1.4
                }]
            },
            alpha: {
                value: 1,
                control: [{
                    x: 0,
                    y: 1
                }, {
                    x: .3,
                    y: 1
                }, {
                    x: .6,
                    y: .2
                }, {
                    x: 1,
                    y: 0
                }]
            },
            vx: {
                value: {
                    min: -2,
                    max: 2
                },
                control: [{
                    x: 0,
                    y: 1
                }, {
                    x: 1,
                    y: 0
                }]
            },
            vy: {
                value: {
                    min: -5,
                    max: 0
                },
                control: [{
                    x: 0,
                    y: 1
                }, {
                    x: 1,
                    y: 0
                }]
            },
            rotation: {
                initial: 0,
                delta: {
                    min: -3,
                    max: 3
                }
            },
            bringToFront: !0
        };
        this.particleManager.addData("explosion", e),
        this.particleEmitter = this.particleManager.createEmitter(),
        this.particleEmitter.addToWorld()
    }
    ,
    this.render = function() {}
    ,
    this.update = function() {
        if (this.groupTop.sort("z", Phaser.Group.SORT_ASCENDING),
        FrauenVsRefugees.GFX && this.viewWindow.filters[0].time++,
        this.frau.alive && null  != t.camera.deadzone) {
            var e = new Phaser.Point;
            e.copyFrom(this.frau),
            e.multiply(this.frau.parent.worldTransform.a, this.frau.parent.worldTransform.d);
            var i = e.x - t.camera.view.x;
            i < t.camera.deadzone.left ? t.camera.view.x = e.x - t.camera.deadzone.left : i > t.camera.deadzone.right && (t.camera.view.x = e.x - t.camera.deadzone.right);
            var a = (this.currentSection + 1) * t.width;
            t.camera.view.x = Math.min(t.camera.view.x, a - t.width)
        }
    }
    ,
    this.addShadow = function(t) {
        this.groupBottom.addChild(t)
    }
    ,
    this.waitForWinTransition = function() {
        this.transitionScreen(this.gotoWinScreen)
    }
    ,
    this.transitionScreen = function(e) {
        var i = this.game.add.graphics(0, 0);
        i.beginFill(0),
        i.lineStyle(1, 0, 1),
        i.drawRect(0, 0, this.game.width, this.game.height),
        i.endFill(),
        i.fixedToCamera = !0;
        var a = t.add.tween(i).to({
            alpha: 1
        }, 1e3, "Linear", !0, 400);
        a.onComplete.add(e, this),
        this.sound.fadeOut()
    }
    ,
    this.gotoWinScreen = function() {
        t.state.start("Win")
    }
    ,
    this.gotoEndScreen = function() {
        t.state.start("Loose")
    }
}
,
FrauenVsRefugees.Game.singleton = null ;
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Intro = function(t) {
    this.create = function() {
       
        this.introComplete = !1,
        this.beginTransition = !1,
        this.beginGameMouseClicked = !1,
        this.viewWindow = FrauenVsRefugees.createViewWindow(),
        t.add.existing(this.viewWindow),
        this.sound = t.add.audio("track-intro", FrauenVsRefugees.MUSIC_VOLUME, !0),
        this.sound.play(),
        this.group = t.add.group(),
        this.groupFont = t.add.group(),
        this.viewWindow.addChild(this.group),
        this.viewWindow.addChild(this.groupFont),
        this.viewWindow.mask.inputEnabled = !0,
        this.viewWindow.mask.events.onInputUp.add(this.beginGameFromClick, this),
        this.intro = t.add.sprite(0, 0, "intro");
        var e = FrauenVsRefugees.VIEW_WIDTH / this.intro.width;

        this.intro.scale.set(e, e),
        this.group.addChild(this.intro),
        this.frau = t.add.sprite(0, 0, "frau"),
        this.frau.anchor.set(.5, 1),
        
        this.frau.introAnimation = this.frau.animations.add("intro", Phaser.Animation.generateFrameNames("slice", 14, 15, ".png", 2), 10, !0),
        this.frau.introAnimation.play(),
        this.frau.x = FrauenVsRefugees.VIEW_CENTER_X,
        this.frau.y = this.intro.height - 60,
        this.frau.scale.set(.7, .7),
        this.group.addChild(this.frau),
        this.groupFont.fixedToCamera = !0,
        this.whereLabel = t.add.bitmapText(10, 10, "fixedsys", "", 22),
        this.groupFont.addChild(this.whereLabel);
        var i = new TypeWriter(this.whereLabel,"WHERE: _",50);
        i.onComplete.add(this.whereLabelComplete, this);
        var a = t.add.image(t.width - 210, t.height - 80, "social", 0);
        a.inputEnabled = !0,
        a.events.onInputUp.add(this.shareFacebook, this);
        var s = t.add.image(t.width - 140, t.height - 80, "social", 1);
        s.inputEnabled = !0,
        s.events.onInputUp.add(this.shareTwitter, this);
        var n = t.add.image(t.width - 70, t.height - 80, "social", 2);
        n.inputEnabled = !0,
        n.events.onInputUp.add(this.shareGoogle, this);
        var o = t.add.sprite(0, 0, "game-logo");
        o.scale.set(.4, .4),
        o.anchor.set(.5, .5),
        o.fixedToCamera = !0,
        o.cameraOffset.set(o.width / 2 + 10, o.height / 2 + 10);
        var r = t.add.sprite(0, 0, "social", 3);
        r.inputEnabled = !0,
        r.events.onInputUp.add(this.showSettings, this),
        r.fixedToCamera = !0,
        r.cameraOffset.set(16, t.height - 80),
        this.showSettingsAfterTransition = !1
    }
    ,
    this.shareFacebook = function() {
        openURLInPopup("http://www.facebook.com/sharer.php?u=http://12brols.com/3brols/frauen-vs-refugees/", 600, 400)
    }
    ,
    this.shareTwitter = function() {
        openURLInPopup("http://twitter.com/home?status=http://12brols.com/3brols/frauen-vs-refugees/", 600, 400)
    }
    ,
    this.shareGoogle = function() {
        openURLInPopup("https://plus.google.com/share?url=http://12brols.com/3brols/frauen-vs-refugees/", 600, 400)
    }
    ,
    this.whereLabelComplete = function() {
        this.whereLabel.hasDashAtTheEnd = !1;
        var e = t.time.events.repeat(250, 8, this.whereLabelBlink, this);
        e.timer.onComplete.addOnce(this.whereValueWrite, this)
    }
    ,
    this.whereLabelBlink = function() {
        this.whereLabel.text = 1 == this.whereLabel.hasDashAtTheEnd ? "WHERE:" : "WHERE: _",
        this.whereLabel.hasDashAtTheEnd = !this.whereLabel.hasDashAtTheEnd
    }
    ,
    this.whereValueWrite = function() {
        this.whereLabel.text = "WHERE:",
        this.whereValue = t.add.bitmapText(this.whereLabel.width + 20, 10, "fixedsys", "", 22),
        this.groupFont.addChild(this.whereValue),
        this.whereValue.tint = 16711680;
        var e = new TypeWriter(this.whereValue,"Köln, Germany ",50);
        e.onComplete.add(this.whereValueComplete, this)
    }
    ,
    this.whereValueComplete = function() {
        this.whenLabel = t.add.bitmapText(10, 30, "fixedsys", "", 22),
        this.groupFont.addChild(this.whenLabel);
        var e = new TypeWriter(this.whenLabel,"WHEN: _",50);
        e.onComplete.add(this.whenLabelComplete, this)
    }
    ,
    this.whenLabelComplete = function() {
        this.whenLabel.hasDashAtTheEnd = !1;
        var e = t.time.events.repeat(250, 8, this.whenLabelBlink, this);
        e.timer.onComplete.addOnce(this.whenValueWrite, this)
    }
    ,
    this.whenLabelBlink = function() {
        this.whenLabel.text = 1 == this.whenLabel.hasDashAtTheEnd ? "WHEN:" : "WHEN: _",
        this.whenLabel.hasDashAtTheEnd = !this.whenLabel.hasDashAtTheEnd
    }
    ,
    this.whenValueWrite = function() {
        this.whenLabel.text = "WHEN:",
        this.whenValue = t.add.bitmapText(this.whereLabel.width + 20, 30, "fixedsys", "", 22),
        this.groupFont.addChild(this.whenValue),
        this.whenValue.tint = 16711680;
        new TypeWriter(this.whenValue,"01.01.2016 00:00:00:000 ",50)
    }
    ,
    this.showIntroText = function() {
        if (this.introText = t.add.bitmapText(10, 130, "fixedsys", "", 16),
        this.groupFont.addChild(this.introText),
        FrauenVsRefugees.TOUCH) {
            new TypeWriter(this.introText,"The Frau Needs Your Help To Get To The Hauptbahnhof..\nUse Arrow Keys To Move, X/C Keys To Fight. \nTouch Here To Start",25)
        } else {
            new TypeWriter(this.introText,"The Frau Needs Your Help To Get To The Hauptbahnhof..\nUse Arrow Keys To Move, X/C Keys To Fight. \nPress SPACE To Start",25)
        }
    }
    ,
    this.showSettings = function() {
        this.beginGameMouseClicked = !0,
        this.showSettingsAfterTransition = !0
    }
    ,
    this.startGame = function() {
        this.sound.destroy(),
        t.state.start(1 == this.showSettingsAfterTransition ? "Settings" : "Game")
    }
    ,
    this.beginGameFromClick = function() {
        FrauenVsRefugees.TOUCH && (this.beginGameMouseClicked = !0)
    }
    ,
    this.update = function() {
        if (1 != this.beginTransition)
            if (t.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR) || 1 == this.beginGameMouseClicked) {
                if (this.sound.fadeOut(),
                this.beginTransition = !0,
                FrauenVsRefugees.GFX) {
                    var e = new PIXI.PixelateFilter;
                    t.world.filters = [e];
                    var i = t.add.tween(e.size).to({
                        x: 200,
                        y: 200
                    }, 500, Phaser.Easing.Exponential.In, !0)
                }
                var a = this.game.add.graphics(0, 0);
                a.beginFill(0),
                a.lineStyle(1, 0, 1),
                a.drawRect(0, 0, this.game.width, this.game.height),
                a.endFill(),
                a.fixedToCamera = !0,
                a.alpha = 0;
                var i = t.add.tween(a).to({
                    alpha: 1
                }, 1e3, "Linear", !0, 400);
                i.onComplete.add(this.startGame, this)
            } else
                this.group.y > -this.intro.height + FrauenVsRefugees.VIEW_HEIGHT + 5 ? this.group.y -= 1 : 0 == this.introComplete && (this.introComplete = !0,
                this.showIntroText())
    }
}
;
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Loose = function(t) {
    this.create = function() {
        
        t.camera.follow(null ),
        t.world.setBounds(0, 0, t.width, t.height),
        t.camera.x = 0,
        t.camera.y = 0,
        this.sound = t.add.audio("track-loose", FrauenVsRefugees.MUSIC_VOLUME, !0),
        this.sound.play(),
        this.introComplete = !1,
        this.beginTransition = !1,
        this.showFrame = 0,
        this.group = t.add.group(),
        this.groupFont = t.add.group(),
        this.groupTransition = t.add.group(),
        this.frau = t.add.sprite(0, 0, "bigguard"),
        this.frau.introAnimation = this.frau.animations.add("intro", [0, 1], 10, !0),
        this.frau.anchor.set(.5, .5),
        this.frau.introAnimation.play(),
        this.frau.x = t.world.centerX,
        this.frau.y = t.world.centerY,
        this.group.addChild(this.frau),
        this.whereLabel = t.add.bitmapText(t.world.centerX, this.frau.y + this.frau.height / 2 + 15, "fixedsys", "Press SPACE To Try Again", 22),
        this.groupFont.addChild(this.whereLabel),
        this.whereLabel.anchor.set(.5, .5);
        var e = t.add.sprite(0, 0, "game-logo");
        e.scale.set(.4, .4),
        e.anchor.set(.5, .5),
        e.fixedToCamera = !0,
        e.cameraOffset.set(e.width / 2 + 10, e.height / 2 + 10)
    }
    ,
    this.startGame = function() {
        this.sound.destroy(),
        t.state.start("Intro")
    }
    ,
    this.update = function() {
        if (this.showFrame++ > 10 && (this.showFrame = 0,
        this.whereLabel.visible = !this.whereLabel.visible),
        1 != this.beginTransition && (t.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR) || FrauenVsRefugees.TOUCH && t.input.activePointer.isDown)) {
            if (this.sound.fadeOut(),
            this.beginTransition = !0,
            FrauenVsRefugees.GFX) {
                var e = new PIXI.PixelateFilter;
                t.world.filters = [e];
                var i = t.add.tween(e.size).to({
                    x: 200,
                    y: 200
                }, 500, Phaser.Easing.Exponential.In, !0)
            }
            var a = this.game.add.graphics(0, 0);
            a.beginFill(0),
            a.lineStyle(1, 0, 1),
            a.drawRect(0, 0, this.game.width, this.game.height),
            a.endFill(),
            this.groupTransition.addChild(a),
            a.alpha = 0;
            var i = t.add.tween(a).to({
                alpha: 1
            }, 1e3, "Linear", !0, 400);
            i.onComplete.add(this.startGame, this)
        }
    }
}
;
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Preload = function(t) {
    this.preload = function() {
        t.load.image("pixel", "assets/images/pixel.png"),
        t.load.onFileComplete.add(this.loadProgress, this);
        var e = t.add.sprite(t.world.centerX, t.world.centerY, "game-logo");
        e.anchor.set(.5, .5),
        this.loadingText = t.add.text(t.world.centerX, t.world.centerY + e.height / 2 + 20, "LOADING...", {
            font: "16px Arial",
            fill: "#ffffff",
            align: "center"
        }),
        this.loadingText.anchor.set(.5, .5),
        t.load.spritesheet("street", "assets/images/street.png", 193, 193),
        this.game.load.atlas("frau", "assets/images/anim/wonderwoman.png", "assets/images/anim/wonderwoman.json"),
        this.game.load.atlas("enemyAzill", "assets/images/anim/longmoan.png", "assets/images/anim/longmoan.json"),
        this.game.load.atlas("enemyAkarab", "assets/images/anim/baraka.png", "assets/images/anim/baraka.json"),
        t.load.atlas("police", "assets/images/anim/police.png", "assets/images/anim/police.json"),
        t.load.atlas("sonya", "assets/images/anim/sonya.png", "assets/images/anim/sonya.json"),
        t.load.spritesheet("progressBar", "assets/images/progressBar.png", 80, 16),
        t.load.spritesheet("arrow-hauptbahnhof", "assets/images/arrow-hauptbahnhof.png", 100, 40),
        t.load.spritesheet("bigguard", "assets/images/anim/bigguard.png", 94, 100),
        t.load.image("tyris", "assets/images/tyris.png"),
        t.load.image("frame", "assets/images/frame.png"),
        t.load.spritesheet("faces", "assets/images/faces.png", 30, 30),
        t.load.spritesheet("social", "assets/images/social.png", 64, 64),
        t.load.bitmapFont("fixedsys", "assets/fonts/fixedsys_0.png", "assets/fonts/fixedsys.fnt"),
        t.load.image("intro", "assets/images/intro.png"),
        t.load.image("shadow", "assets/images/shadow.png"),
        t.load.image("arrow-back", "assets/images/arrow-back.png"),
        t.load.script("filmfilter", "libs/filters/FilmFilter.js"),
        t.load.script("sepia", "libs/filters/pixi/SepiaFilter.js"),
        t.load.script("pixelate", "libs/filters/pixi/PixelateFilter.js"),
        t.load.audio("track-intro", ["assets/sounds/intro.mp3", "assets/sounds/intro.ogg"]),
        t.load.audio("track-win", ["assets/sounds/solstice.mp3", "assets/sounds/solstice.ogg"]),
        t.load.audio("track-game", ["assets/sounds/gameplay-track1.mp3", "assets/sounds/gameplay-track1.ogg"]),
        t.load.audio("track-loose", ["assets/sounds/loose-track.mp3", "assets/sounds/loose-track.ogg"]),
        t.load.audio("frau-jump", ["assets/sounds/frau-yeah.mp3", "assets/sounds/frau-yeah.ogg"]),
        t.load.audio("frau-fall", ["assets/sounds/woman-fall.mp3", "assets/sounds/woman-fall.mp3"]),
        t.load.audio("man-fall", ["assets/sounds/man-fall.mp3", "assets/sounds/man-fall.mp3"]),
        t.load.audio("excelent", ["assets/sounds/excelent.mp3", "assets/sounds/excelent.mp3"]),
        t.load.audio("man-punch", ["assets/sounds/man-punch.mp3", "assets/sounds/man-punch.ogg"]),
        t.load.audio("man-hit", ["assets/sounds/man-hit.mp3", "assets/sounds/man-hit.ogg"]),
        t.load.audio("woman-punch", ["assets/sounds/woman-punch.mp3", "assets/sounds/woman-punch.mp3"]),
        t.load.audio("man-kick-hit", ["assets/sounds/man-kick-hit.mp3", "assets/sounds/man-kick-hit.mp3"]),
        t.load.audio("test", ["assets/sounds/test.mp3", "assets/sounds/test.mp3"]),
        t.load.spritesheet("controller-arrows", "assets/images/controller-arrows.png", 100, 100),
        t.load.spritesheet("controller-buttons", "assets/images/controller-buttons.png", 70, 72)
    }
    ,
    this.loadProgress = function(t, e, i, a) {
        this.loadingText.alpha = a % 2 ? !0 : !1
    }
    ,
    this.create = function() {
        t.state.start("Intro")
    }
}
;
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Settings = function(t) {
    this.create = function() {

        t.camera.follow(null ),
        t.world.setBounds(0, 0, t.width, t.height),
        t.camera.x = 0,
        t.camera.y = 0,
        this.sound = t.add.audio("track-game", FrauenVsRefugees.MUSIC_VOLUME, !0),
        this.sound.play(),
        this.punchSound = t.add.audio("test", FrauenVsRefugees.VOLUME, !1),
        this.punchSound.volume = 0,
        this.punchSound.play(),
        this.beginTransition = !1,
        this.group = t.add.group();
        var e = t.add.sprite(0, 0, "game-logo");
        e.scale.set(.4, .4),
        e.anchor.set(.5, .5),
        e.fixedToCamera = !0,
        e.cameraOffset.set(e.width / 2 + 10, e.height / 2 + 10);
        var i = t.add.bitmapText(43, 130, "fixedsys", "Music Volume:", 22)
          , a = new Slider(220,i.y + 4,{
            width: 300,
            height: 15,
            buttonWidth: 10,
            buttonHeight: 13,
            value: FrauenVsRefugees.MUSIC_VOLUME,
            valueMin: 0,
            valueMax: 1
        });
        t.add.existing(a),
        a.onChange.add(this.musicVolumeChanged, this);
        var s = t.add.bitmapText(43, 170, "fixedsys", "Fx Volume:", 22)
          , n = new Slider(220,s.y + 4,{
            width: 300,
            height: 15,
            buttonWidth: 10,
            buttonHeight: 13,
            value: FrauenVsRefugees.VOLUME,
            valueMin: 0,
            valueMax: 1
        });
        t.add.existing(n),
        n.onChange.add(this.fxChanged, this);
        var o = t.add.bitmapText(43, 210, "fixedsys", "gfx quality:", 22)
          , r = new Checkbox(220,o.y + 4,{
            width: 15,
            height: 15,
            buttonWidth: 5,
            buttonHeight: 5,
            value: FrauenVsRefugees.GFX
        });
        t.add.existing(r),
        r.onChange.add(this.gfxChanged, this);
        var h = t.add.sprite(0, 0, "arrow-back");
        h.anchor.set(0, 1),
        h.position.set(10, t.height - 10),
        h.inputEnabled = !0,
        h.events.onInputDown.add(this.backButtonClicked, this),
        this.backClicked = !1
    }
    ,
    this.backButtonClicked = function() {
        this.backClicked = !0
    }
    ,
    this.musicVolumeChanged = function(t) {
        FrauenVsRefugees.MUSIC_VOLUME != t && (FrauenVsRefugees.MUSIC_VOLUME = t,
        this.sound.volume = t)
    }
    ,
    this.fxChanged = function(t) {
        FrauenVsRefugees.VOLUME != t && (FrauenVsRefugees.VOLUME = t,
        this.punchSound.volume = t,
        FrauenVsRefugees.SoundManager.play(this.punchSound, 50))
    }
    ,
    this.gfxChanged = function(t) {
        FrauenVsRefugees.GFX = t
    }
    ,
    this.startGame = function() {
        this.sound.destroy(),
        t.state.start("Intro")
    }
    ,
    this.update = function() {
        if (1 != this.beginTransition && 1 == this.backClicked) {
            if (this.sound.fadeOut(),
            this.beginTransition = !0,
            FrauenVsRefugees.GFX) {
                var e = new PIXI.PixelateFilter;
                t.world.filters = [e];
                var i = t.add.tween(e.size).to({
                    x: 200,
                    y: 200
                }, 500, Phaser.Easing.Exponential.In, !0)
            }
            var a = this.game.add.graphics(0, 0);
            a.beginFill(0),
            a.lineStyle(1, 0, 1),
            a.drawRect(0, 0, this.game.width, this.game.height),
            a.endFill(),
            a.fixedToCamera = !0,
            a.alpha = 0;
            var i = t.add.tween(a).to({
                alpha: 1
            }, 1e3, "Linear", !0, 400);
            i.onComplete.add(this.startGame, this)
        }
    }
}
;
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Win = function(t) {
    this.create = function() {
        this.sound = t.add.audio("track-win", FrauenVsRefugees.VOLUME, !0),
        this.sound.play(),
        t.camera.follow(null ),
        t.world.setBounds(0, 0, t.width, t.height),
        t.camera.x = 0,
        t.camera.y = 0,
        this.introComplete = !1,
        this.beginTransition = !1,
        this.showFrame = 0,
        this.group = t.add.group(),
        this.groupFont = t.add.group(),
        this.groupTransition = t.add.group(),
        this.frau = t.add.sprite(0, 0, "frau"),
        this.frau.anchor.set(.5, .5),
        this.frau.introAnimation = this.frau.animations.add("intro", Phaser.Animation.generateFrameNames("slice", 14, 15, ".png", 2), 10, !0),
        this.frau.introAnimation.play(),
        this.frau.x = t.world.centerX,
        this.frau.y = t.world.centerY - 10,
        this.frau2 = t.add.sprite(0, 0, "sonya", "slice06.png"),
        this.frau2.anchor.set(.5, .5),
        this.frau2.x = t.world.centerX - 60,
        this.frau2.y = t.world.centerY - 10,
        this.frau3 = t.add.sprite(0, 0, "tyris"),
        this.frau3.anchor.set(.5, .5),
        this.frau3.x = t.world.centerX + 60,
        this.frau3.y = t.world.centerY - 10,
        this.whereLabel = t.add.bitmapText(t.world.centerX, this.frau.y + this.frau.height / 2 + 25, "fixedsys", " Well Done Solder!\nNow Make Some Love!", 22),
        this.groupFont.addChild(this.whereLabel),
        this.whereLabel.anchor.set(.5, .5)
    }
    ,
    this.startGame = function() {
        this.sound.destroy(),
        t.state.start("Intro")
    }
    ,
    this.update = function() {
        if (this.showFrame++ > 10 && (this.showFrame = 0,
        this.whereLabel.visible = !this.whereLabel.visible),
        1 != this.beginTransition && t.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR)) {
            this.sound.fadeOut(),
            this.beginTransition = !0;
            var e = new PIXI.PixelateFilter;
            t.world.filters = [e];
            var i = t.add.tween(e.size).to({
                x: 200,
                y: 200
            }, 500, Phaser.Easing.Exponential.In, !0)
              , a = this.game.add.graphics(0, 0);
            a.beginFill(0),
            a.lineStyle(1, 0, 1),
            a.drawRect(0, 0, this.game.width, this.game.height),
            a.endFill(),
            this.groupTransition.addChild(a),
            a.alpha = 0;
            var i = t.add.tween(a).to({
                alpha: 1
            }, 1e3, "Linear", !0, 400);
            i.onComplete.add(this.startGame, this)
        }
    }
}
;
var FrauenVsRefugees = FrauenVsRefugees || {};
FrauenVsRefugees.Win = function(e) {
    this.create = function() {

        e.camera.follow(null ),
        e.world.setBounds(0, 0, e.width, e.height),
        e.camera.x = 0,
        e.camera.y = 0,
        this.sound = e.add.audio("track-win", FrauenVsRefugees.VOLUME, !0),
        this.sound.play(),
        this.introComplete = !1,
        this.beginTransition = !1,
        this.showFrame = 0,
        this.scrolling = !1,
        this.group = e.add.group(),
        this.groupFont = e.add.group(),
        this.groupTransition = e.add.group(),
        this.frau = e.add.sprite(0, 0, "frau"),
        this.frau.anchor.set(.5, 1),
        this.frau.introAnimation = this.frau.animations.add("intro", Phaser.Animation.generateFrameNames("slice", 14, 15, ".png", 2), 10, !0),
        this.frau.introAnimation.play(),
        this.frau.x = e.world.centerX,
        this.frau.y = e.world.height - 10,
        this.group.addChild(this.frau),
        this.frau2 = e.add.sprite(0, 0, "sonya", "slice06.png"),
        this.frau2.anchor.set(.5, 1),
        this.frau2.x = e.world.centerX - 60,
        this.frau2.y = e.world.height - 10,
        this.group.addChild(this.frau2),
        this.frau3 = e.add.sprite(0, 0, "tyris"),
        this.frau3.anchor.set(.5, 1),
        this.frau3.x = e.world.centerX + 60,
        this.frau3.y = e.world.height - 10,
        this.group.addChild(this.frau3),
        this.victoryText = e.add.bitmapText(e.world.centerX, e.world.centerY, "fixedsys", "VICTORY!", 32),
        this.groupFont.addChild(this.victoryText),
        this.victoryText.anchor.set(.5, .5);
        var t = e.add.graphics(0, 0);
        t.beginFill(0),
        t.drawRect(0, 0, e.width, e.height - this.frau.height - 30),
        t.endFill(),
        t.fixedToCamera = !0,
        this.groupFont.mask = t;
        var i = (e.time.events.add(500, this.scrollCredits, this),
        e.add.sprite(0, 0, "game-logo"));
        i.scale.set(.4, .4),
        i.anchor.set(.5, .5),
        i.fixedToCamera = !0,
        i.cameraOffset.set(i.width / 2 + 10, i.height / 2 + 10)
    }
    ,
    this.scrollCredits = function() {
        this.scrolling = !0,
        t = this.addText("DEVELOPED BY:", e.world, e.height - this.frau.height, 28),
        t = this.addText("www.12brols.com", t, 30, 22),
        t = this.addText("12brols@gmail.com", t, 30, 22),
        t = this.addText("GRAPHICS FROM:", t, 150, 30),
        t = this.addText("Golden Axe (1989), Sega", t, 30, 22),
        t = this.addText("Streets of Rage (1991), Sega", t, 30, 22),
        t = this.addText("Mortal Kombat 2 (1993), Midway Games", t, 30, 22),
        t = this.addText("SOUNDS FROM:", t, 150, 30),
        t = this.addText("Golden Axe (1989), Sega", t, 30, 22),
        t = this.addText("Solstice (1995), valhalla", t, 30, 22),
        t = this.addText("Volfied (1989), Taito", t, 30, 22),
        t = this.addText("Mortal Kombat 2 (1993), Midway Games", t, 30, 22),
        t = this.addText("Lazaretto (8 Bit Remix Cover Version) (Youtube)", t, 30, 22),
        t = this.addText("SPECIAL THANKS TO:", t, 150, 30),
        t = this.addText("www.spriters-resource.com", t, 30, 22),
        t = this.addText("www.sounds-resource.com", t, 30, 22),
        t = this.addText("KalerabGang, www.kalerabgang.tv", t, 30, 22),
        t = this.addText("Phaser, www.phaser.io", t, 30, 22),
        t = this.addText("No women were harmed in making this game", t, 200, 22),
        t = this.addText("No refugees were harmed in making this game", t, 40, 22),
        t = this.addText("Drop me a line if you feel something is not right", t, 200, 22),
        t = this.addText("12brols@gmail.com", t, 30, 16),
        t = this.addText("And most importantly", t, 200, 22),
        t = this.addText("DON'T FIGHT - MAKE LOVE", t, 40, 32),
        this.lastText = this.addText("and games", t, 32, 12)
    }
    ,
    this.addText = function(t, i, a, s) {
        var n = e.add.bitmapText(e.world.centerX, this.frau.y + this.frau.height / 2 + 25, "fixedsys", t, s);
        return this.groupFont.addChild(n),
        n.anchor.set(.5, .5),
        n.y = i.y + a,
        n
    }
    ,
    this.startGame = function() {
        this.sound.destroy(),
        e.state.start("Intro")
    }
    ,
    this.update = function() {
        if (1 == this.scrolling ? null  != this.groupFont && (this.groupFont.y > -this.lastText.y - 100 ? this.groupFont.y -= 1 : (this.scrolling = !1,
        this.victoryText = e.add.bitmapText(e.world.centerX, e.world.centerY, "fixedsys", "VICTORY!", 32),
        this.victoryText.anchor.set(.5, .5),
        this.blinkText = e.add.bitmapText(e.world.centerX, e.world.centerY + 32, "fixedsys", "Press SPACE To Start", 16),
        this.blinkText.anchor.set(.5, .5))) : null  != this.blinkText && this.showFrame++ > 10 && (this.showFrame = 0,
        this.blinkText.visible = !this.blinkText.visible),
        1 != this.beginTransition && (e.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR) || FrauenVsRefugees.TOUCH && e.input.activePointer.isDown)) {
            if (this.beginTransition = !0,
            FrauenVsRefugees.GFX) {
                var t = new PIXI.PixelateFilter;
                e.world.filters = [t];
                var i = e.add.tween(t.size).to({
                    x: 200,
                    y: 200
                }, 500, Phaser.Easing.Exponential.In, !0)
            }
            var a = this.game.add.graphics(0, 0);
            a.beginFill(0),
            a.lineStyle(1, 0, 1),
            a.drawRect(0, 0, this.game.width, this.game.height),
            a.endFill(),
            this.groupTransition.addChild(a),
            a.alpha = 0;
            var i = e.add.tween(a).to({
                alpha: 1
            }, 1e3, "Linear", !0, 400);
            i.onComplete.add(this.startGame, this)
        }
    }
}
;
var MobileControler = function() {
    MobileControler.singleton = this,
    this.radius = 24,
    this.knobFingerId = -1,
    this.direction = null ,
    this.isKicking = !1,
    this.isPunching = !1,
    Phaser.Sprite.call(this, game, 0, 0, "pixel"),
    this.onNavigation = new Phaser.Signal,
    this.background = game.add.sprite(0, 0, "controller-arrows", 1),
    this.background.anchor.set(.5, .5),
    this.addChild(this.background),
    this.knob = game.add.sprite(0, 0, "controller-arrows", 0),
    this.knob.anchor.set(.5, .5),
    this.addChild(this.knob),
    this.knob.inputEnabled = !0,
    this.knob.events.onInputDown.add(this.startKnobDrag, this),
    this.knob.events.onInputUp.add(this.stopKnobDrag, this),
    this.buttonKick = game.add.sprite(0, 0, "controller-buttons", 0),
    this.buttonKick.x = game.width - 200,
    this.buttonKick.inputEnabled = !0,
    this.buttonKick.events.onInputDown.add(this.startKick, this),
    this.buttonKick.events.onInputUp.add(this.stopKick, this),
    this.addChild(this.buttonKick),
    this.buttonPunch = game.add.sprite(0, 0, "controller-buttons", 1),
    this.buttonPunch.x = game.width - 270,
    this.buttonPunch.y = -50,
    this.buttonPunch.inputEnabled = !0,
    this.buttonPunch.events.onInputDown.add(this.startPunch, this),
    this.buttonPunch.events.onInputUp.add(this.stopPunch, this),
    this.addChild(this.buttonPunch),
    this.fixedToCamera = !0,
    this.cameraOffset.set(this.background.width, game.height - this.background.height)
}
;
MobileControler.prototype = Object.create(Phaser.Sprite.prototype),
MobileControler.prototype.constructor = MobileControler,
MobileControler.prototype.startKick = function() {
    this.isKicking = !0
}
,
MobileControler.prototype.stopKick = function() {
    this.isKicking = !1
}
,
MobileControler.prototype.startPunch = function() {
    this.isPunching = !0
}
,
MobileControler.prototype.stopPunch = function() {
    this.isPunching = !1
}
,
MobileControler.prototype.startKnobDrag = function(t, e) {
    this.direction = Frau.Directions.none,
    this.knobFingerId = e.id,
    this.moveCallback = game.input.addMoveCallback(this.dragKnob, this),
    this.knob.events.onInputUp.add(this.stopKnobDrag, this)
}
,
MobileControler.prototype.dragKnob = function(t) {
    if (t.id == this.knobFingerId) {
        var e = this.worldTransform.applyInverse(t.position)
          , i = Math.min(e.getMagnitude(), this.radius)
          , a = Math.atan2(e.y, e.x);
        this.knob.x = Math.cos(a) * i,
        this.knob.y = Math.sin(a) * i,
        a += Math.PI / 4,
        0 > a && (a += 2 * Math.PI),
        a *= 180 / Math.PI,
        90 > a ? this.direction = Frau.Directions.right : 180 > a ? this.direction = Frau.Directions.down : 270 > a ? this.direction = Frau.Directions.left : 360 > a && (this.direction = Frau.Directions.up)
    }
}
,
MobileControler.prototype.stopKnobDrag = function(t, e) {
    if (e.id == this.knobFingerId) {
        this.knobFingerId = -1,
        this.knob.events.onInputUp.remove(this.stopKnobDrag, this),
        game.input.deleteMoveCallback(this.moveCallback);
        var i = game.add.tween(this.knob);
        i.to({
            x: 0,
            y: 0
        }, 100, Phaser.Easing.Exponential.Out),
        i.start(),
        this.direction = Frau.Directions.none
    }
}
,
MobileControler.singleton = null ;
var ParentSprite = function() {
    Phaser.Sprite.call(this, game, 0, 0)
}
;
ParentSprite.prototype = Object.create(Phaser.Sprite.prototype),
ParentSprite.prototype.constructor = ParentSprite,
ParentSprite.prototype.update = function() {
    for (var t = this.children.length; t--; )
        this.children[t].update()
}
;
var ProgressBar = function(t) {
    this.direction = t,
    this.currentTarget = null ,
    Phaser.Sprite.call(this, game, 0, 0, "pixel"),
    this.faceImage = new Phaser.Sprite(game,0,0,"faces",0),
    this.addChildAt(this.faceImage, 0);
    var e = new Phaser.Sprite(game,0,0,"frame");
    if (this.addChild(e),
    "left" == t)
        this.addChild(new Phaser.Sprite(game,29,14,"progressBar",0)),
        this.progress = this.addChild(new Phaser.Sprite(game,29,14,"progressBar",1)),
        this.text = game.add.text(35, -1, "Name", {
            font: "12px Arial",
            fill: "#ffffff",
            align: "center"
        }),
        this.addChild(this.text);
    else {
        var i = new Phaser.Sprite(game,0,14,"progressBar",0);
        i.anchor.set(1, 0),
        this.addChild(i),
        this.progress = new Phaser.Sprite(game,0,14,"progressBar",1),
        this.progress.anchor.set(1, 0),
        this.addChild(this.progress),
        this.text = game.add.text(-5, -1, "Name", {
            font: "12px Arial",
            fill: "#ffffff",
            align: "right"
        }),
        this.text.anchor.set(1, 0),
        this.addChild(this.text)
    }
}
;
ProgressBar.prototype = Object.create(Phaser.Sprite.prototype),
ProgressBar.prototype.constructor = ProgressBar,
ProgressBar.prototype.updateState = function(t) {
    this.currentTarget = t,
    this.faceImage.frame = t.faceImage,
    this.text.text = t.name,
    this.progress.scale.x = Math.max(0, t.health),
    this.visible = !0
}
,
ProgressBar.prototype.hideIfObjectIsDead = function(t) {
    this.currentTarget == t && (this.visible = !1)
}
;
var Slider = function(t, e, i) {
    i = i || {},
    this.settings = FrauenVsRefugees.extendObject({
        backgroundColor: 16777215,
        buttonColor: 16711680,
        width: 100,
        height: 32,
        buttonWidth: 32,
        buttonHeight: 30,
        valueMin: 0,
        valueMax: 1,
        value: .5
    }, i),
    this.knobFingerId = 0,
    Phaser.Sprite.call(this, game, t, e, "pixel"),
    this.onChange = new Phaser.Signal;
    var a = this.game.add.graphics(0, 0);
    a.beginFill(this.settings.backgroundColor),
    a.lineStyle(1, this.settings.backgroundColor, 1),
    a.drawRect(-1, 0, this.settings.width + 2, this.settings.height),
    a.endFill(),
    this.background = game.add.sprite(0, 0, "pixel"),
    this.background.addChild(a),
    this.addChild(this.background);
    var a = this.game.add.graphics(0, 0);
    a.beginFill(this.settings.buttonColor),
    a.lineStyle(1, this.settings.buttonColor, 1),
    a.drawRect(0, 0, this.settings.buttonWidth, this.settings.buttonHeight),
    a.endFill(),
    a.y = (this.settings.height - this.settings.buttonHeight) / 2,
    this.knob = game.add.sprite(0, 0, "pixel"),
    this.knob.addChild(a),
    this.addChild(this.knob),
    this.knob.inputEnabled = !0,
    this.knob.input.enableDrag(!1, !1, !1, 255, new Phaser.Rectangle(0,0,1 + this.settings.width - this.settings.buttonWidth,this.settings.height)),
    this.knob.input.allowVerticalDrag = !1,
    this.knob.events.onDragUpdate.add(this.dragUpdate, this),
    this.value = this.settings.value
}
;
Slider.prototype = Object.create(Phaser.Sprite.prototype),
Slider.prototype.constructor = Slider,
Slider.prototype.dragUpdate = function() {
    var t = this.settings.width - this.settings.buttonWidth
      , e = this.knob.x / t;
    this.settings.value = (this.settings.valueMax - this.settings.valueMin) * e,
    this.onChange.dispatch(this.settings.value)
}
,
Object.defineProperty(Slider.prototype, "value", {
    get: function() {
        return this.settings.value
    },
    set: function(t) {
        this.settings.value = t;
        var e = Math.max(this.settings.valueMin, Math.min(this.settings.valueMax, (t - this.settings.valueMin) / (this.settings.valueMax - this.settings.valueMin)));
        this.knob.x = (this.settings.width - this.settings.buttonWidth) * e
    }
});
var TestSprite = function() {
    Phaser.Sprite.call(this, game, 0, 0)
}
;
TestSprite.prototype = Object.create(Phaser.Sprite.prototype),
TestSprite.prototype.constructor = TestSprite,
TestSprite.prototype.update = function() {
    console.log("updating ")
}
;
var TypeWriter = function(t, e, i) {
    this.value = e,
    this.text = t,
    this.speed = i,
    this.currentChar = 0,
    this.onComplete = new Phaser.Signal,
    this.timer = game.time.events.repeat(i, this.value.length, this.type, this)
}
;
TypeWriter.prototype.type = function() {
    return this.currentChar++,
    this.text.text = this.value.substr(0, this.currentChar),
    this.currentChar >= this.value.length ? void this.onComplete.dispatch() : void 0
}
;
